Lex Customer Contract Import
Introduction
This will import Lex vehicles in to ViSN
download sample Lex customer contract import file.
File format
Comma Separated Values - *.csv
Encoding - UTF-8
Lex Customer Customers Import
Column Position | Lex Customer contract fields | Description | Max length | Data Type | Rules | Mandatory | Example |
---|---|---|---|---|---|---|---|
C | Registration | Vehicle Registration number | 10 | String | A-Z & 0-9 Characters | Y | AH23KJH |
D | Asset Number | Asset Number | 20 | String | A-Z & 0-9 | N | 88 AX29-UE39 |
E | Scheme Data Ref | Scheme Data Ref | 10 | String | A-Z 0-9 and Special Characters | N | SALCA2AN9MH8#90904 |
F | CAPID | Cap Id | 20 | String | A-Z 0-9 and Special Characters | N | QW82JK764HSN |
G | Make | Make of the vehicle | 20 | String | A-Z 0-9 and Special Characters | N | Ford |
H | Model | Model of the vehicle | 100 | String | A-Z 0-9 and Special Characters | N | Escape |
I | Derivative | variant | 100 | String | A-Z 0-9 and Special Characters | N | Manual transmission |
J | Colour | Colour of Vehicle | 100 | String | A-Z 0-9 and Special Characters | N | Pearl White |
K | Registration Date | Registration Date | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
L | Contract Start Date | Start date of contract | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
M | Contract End Date | End date of contract | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
O | Fuel Type | Fuel type of vehicle | 1 | String | Either X, P, U, D, O, F | N | P |
R | Contract Mileage Term | Mileage of Vehicle | 6 | Number | 0-9 | N | 33448 |
S | VIN | Chassis Number | 20 | String | A-Z 0-9 | N | SALCA2AN9MH890904 |
T | Driver Name | Driver first name | 50 | String | A-Z 0-9 and Special Characters | N | Andre |
U | Driver Number | Contact Telephone1 | 15 | Number | 0-9 | N | 23821828 |
U | Driver Mobile Number | Contact Telephone2 | 15 | Number | 0-9 | N | 23821828 |
X | Authority Notes | Authority Notes | 150 | String | A-Z 0-9 and Special Characters | N | TestTest |
Y | Driver Email | Contact Email | 50 | String | Standard email format | N | driver@email.com |
AB | Deleted | Only "Maintained" vehicles are imported, if the value is other than N, then it is ignored and a log is added | NA | String | Y or N | N | Y |
AC | Customer Account Number | Customer Account Number | 100 | String | A-Z 0-9 and Special Characters | N | XW442TYW |
AH | MOT Due date | Last date for MOT | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
AI | RFL Renewal Date | RFL Renewal Date | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
AJ | Warranty Expiry Date | Warranty Expiry Date | NA | Date | DD/MM/YYYY | N | 30/10/2024 |
AJ | Warranty Parameter Mileage | Warranty mileage | 6 | Number | 0-9 | N | 223445 |
AO | Service Program Included Flag | Service Program Included Flag | 15 | Boolean | Y or N | N | Y |
AP | Service Program Text | Service Program Text | 15 | String | A-Z 0-9 and Special Characters | N | Test |
Importing a File
Preparation
- Create a new branch including the Jira task number in the branch name.
- Delete all files in the
importFiles
folder. - Create a folder with the current sprint number.
- Copy the file that needs to be imported to the created folder.
- Update
package.json
:- Locate the line for
validate:lexCustomerContract
. - Update
--leaseId
with the required lease ID. - Update
--file
with the relative path of the file.
- Locate the line for
- Save
package.json
.
Local Validation
- In a terminal, run
npm run build
. - Run the validation script:
npm run validate:lexCustomerContract
. - If validation passes without errors, push the code.
Workflow Validation
- Navigate to Actions in the Import Manager.
- Locate
<Environment> - on-demand-import
. - Select the branch created for this import.
- Enter the script name as
validate:lexCustomerContract
. - Leave the Overrides field empty.

Importing the File
- If the validation passes, proceed with the import.
- Navigate to Actions in the Import Manager.
- Locate
<Environment> - on-demand-import
. - Select the branch created for this import.
- Enter the script name as
import:lexCustomerContract
. - Enter
--persist
in the Overrides field.


Importing the File via Cloud Run
Creating Schedulers for Lex Customer Contract Validation
- Go to Cloud Scheduler and select CREATE JOB.
Scheduler Setup
Configure a Cloud Scheduler with the following parameters:
- Name: lex_customer_contract_import_file_validation
- Region: europe-west2
- Frequency:
0 0 31 12 1
- Time Zone: British Summer Time (BST)
- Target Type: HTTP
- URL:
https://import-manager-36r2bu4izq-uc.a.run.app/customer-contract
- HTTP Method: POST
- Auth Header: Select OIDC Token
- Service Account:
cloud-run-import-customer-contract
- Body: Include the following JSON object:
{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "false",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexCustomerContract.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_CUSTOMER_CONTRACT"
}
Lex Customer Contract Scheduler Setup
This guide explains how to create Cloud Schedulers for validating and importing Lex customer contracts.
Creating Schedulers for Validating the Lex Customer Contract


Steps to Create Scheduler for Importing Lex Customer Contract
- Go to Cloud Scheduler.
- Select CREATE JOB.
Required Setup
Configure the Cloud Scheduler with the following parameters:
- Name:
lex_customer_contract_file_import
- Region:
europe-west2
- Frequency:
0 0 31 12 1
- TimeZone:
GMT London
- Target type: HTTP
- URL:
https://import-manager-36r2bu4izq-uc.a.run.app/customer-contract
- HTTP method: POST
- Auth header: Select
OIDC token
- Service account:
cloud-run-import-customer-contract
- Body: JSON object with the following parameters:
{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "true",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexCustomerContract.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_CUSTOMER_CONTRACT"
}
Lex Customer Contract Import Scheduler
This guide covers the steps to create and configure Cloud Schedulers for importing and validating Lex customer contracts.
Creating Scheduler for Importing Lex Customer Contract


Preparation
- Bucket Name:
biddirect-2.appspot.com
(bucket name may vary across environments). - File Path: The file should be placed in
imports/fileDrop
within the bucket, using the CSV file named lexCustomerContract. Uploading to this path will place the file in the specified location within the designated bucket.

Validation
- Go to Cloud Scheduler.
- Run the
lex_customer_contract_import_file_validation
job (job name may vary in different environments).

Importing
- Go to Cloud Scheduler.
- Run the
lex_customer_contract_file_import
job (job name may vary in different environments).

Testing
- After running the import, verify that Lex vehicles have been successfully imported by navigating to the ViSN customer platform.
- Go to Vehicle Record and search for the imported vehicle to confirm the import process was successful.
Status: Accepted
Category: Protected
Authored By: Jeyakumar Arunagiri on Oct 30, 2024
Revisions